package io.renren.modules.study.controller;


import io.renren.common.annotation.Login;
import io.renren.common.utils.R;
import io.renren.modules.study.service.IntergeralService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

@RestController
@RequestMapping("/api/integral")
@Api(tags="积分接口")
public class IntegralController {
    @Autowired
    IntergeralService intergralService;


    @Login
    @GetMapping("getMyIntergralHistoryList")
    @ApiOperation("获得我的积分记录")
    public R getMyIntergralHistoryList(@ApiIgnore @RequestAttribute("userId") Long userId){
        System.out.println(userId);
        List list=intergralService.getMyIntergralHistoryList(Math.toIntExact(userId));
        return R.ok("",100).put("data",list);
    }
}
